<?php
namespace Plugin\Attractions\Broadcast\Schema\Broadcast_execution_log;

use Plugin\Attractions\Broadcast\Model\Broadcast_execution_log\BroadcastExecutionLog;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 广播执行日志
 */
#[Schema(title: 'BroadcastExecutionLogSchema')]
class BroadcastExecutionLogSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'plan_id', title: '计划ID', type: 'bigint')]
    public string $plan_id;

    #[Property(property: 'execution_type', title: '执行类型：1-计划执行，2-手动执行，3-应急执行', type: 'tinyint')]
    public string $execution_type;

    #[Property(property: 'broadcast_content', title: '广播内容', type: 'text')]
    public string $broadcast_content;

    #[Property(property: 'start_time', title: '开始播放时间', type: 'timestamp')]
    public string $start_time;

    #[Property(property: 'end_time', title: '结束播放时间', type: 'timestamp')]
    public string $end_time;

    #[Property(property: 'actual_duration', title: '实际执行时长（秒）', type: 'int')]
    public string $actual_duration;

    #[Property(property: 'execution_status', title: '执行状态：1-执行中，2-已完成，3-失败', type: 'tinyint')]
    public string $execution_status;

    #[Property(property: 'fail_reason', title: '失败原因', type: 'varchar')]
    public string $fail_reason;

    #[Property(property: 'volume_level', title: '播放音量', type: 'tinyint')]
    public string $volume_level;

    #[Property(property: 'remark', title: '备注', type: 'text')]
    public string $remark;

    #[Property(property: 'device_id', title: '设备id', type: 'int')]
    public string $device_id;

    #[Property(property: 'file', title: '文件url', type: 'varchar')]
    public string $file;



    public function __construct(BroadcastExecutionLog $model)
    {
       $this->id = $model->id;
       $this->plan_id = $model->plan_id;
       $this->execution_type = $model->execution_type;
       $this->broadcast_content = $model->broadcast_content;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->actual_duration = $model->actual_duration;
       $this->execution_status = $model->execution_status;
       $this->fail_reason = $model->fail_reason;
       $this->volume_level = $model->volume_level;
       $this->remark = $model->remark;
       $this->device_id = $model->device_id;
       $this->file = $model->file;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'plan_id' => $this->plan_id ,'execution_type' => $this->execution_type ,'broadcast_content' => $this->broadcast_content ,'start_time' => $this->start_time ,'end_time' => $this->end_time ,'actual_duration' => $this->actual_duration ,'execution_status' => $this->execution_status ,'fail_reason' => $this->fail_reason ,'volume_level' => $this->volume_level ,'remark' => $this->remark, 'device_id' => $this->device_id, 'file' => $this->file];
    }
}